package wangxiaotao.controller;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import wangxiaotao.common.CommonResult;
import wangxiaotao.converter.LogsConverter;
import wangxiaotao.entity.Logs;

@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/admin/log")
public class LogController extends BaseController{
    private final LogsConverter logsConverter;

    @GetMapping("/list")
    public CommonResult getAllLog(@RequestParam(value = "type",required = false)String type,
                                  @RequestParam(value = "data",required = false)String data){
        Page<Logs> page = logServer.page(getPage(), new QueryWrapper<Logs>().like(StrUtil.isNotBlank(type), type, data));
//        page.setRecords(logsConverter.toLogsVOList(page.getRecords()));
        return CommonResult.success(page);
    }
}
